// Generated from C:\antlrprojects\logica_proposicional\logprop.g4 by ANTLR 4.1
package dpll.parser;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.misc.*;
import org.antlr.v4.runtime.tree.*;
import java.util.List;
import java.util.Iterator;
import java.util.ArrayList;

@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public class logpropParser extends Parser {
	protected static final DFA[] _decisionToDFA;
	protected static final PredictionContextCache _sharedContextCache =
		new PredictionContextCache();
	public static final int
		PUNTOCOMA=1, PARIZ=2, PARDE=3, NO=4, Y=5, O=6, SI=7, SISOLOSI=8, BOOLEANO=9, 
		LITERAL=10, WS=11;
	public static final String[] tokenNames = {
		"<INVALID>", "';'", "'('", "')'", "NO", "Y", "O", "SI", "SISOLOSI", "BOOLEANO", 
		"LITERAL", "WS"
	};
	public static final int
		RULE_formulas = 0, RULE_formula = 1, RULE_proposicion = 2, RULE_termino = 3;
	public static final String[] ruleNames = {
		"formulas", "formula", "proposicion", "termino"
	};

	@Override
	public String getGrammarFileName() { return "logprop.g4"; }

	@Override
	public String[] getTokenNames() { return tokenNames; }

	@Override
	public String[] getRuleNames() { return ruleNames; }

	@Override
	public ATN getATN() { return _ATN; }

	public logpropParser(TokenStream input) {
		super(input);
		_interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
	}
	public static class FormulasContext extends ParserRuleContext {
		public List<FormulaContext> formula() {
			return getRuleContexts(FormulaContext.class);
		}
		public FormulaContext formula(int i) {
			return getRuleContext(FormulaContext.class,i);
		}
		public FormulasContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_formulas; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof logpropListener ) ((logpropListener)listener).enterFormulas(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof logpropListener ) ((logpropListener)listener).exitFormulas(this);
		}
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof logpropVisitor ) return ((logpropVisitor<? extends T>)visitor).visitFormulas(this);
			else return visitor.visitChildren(this);
		}
	}

	public final FormulasContext formulas() throws RecognitionException {
		FormulasContext _localctx = new FormulasContext(_ctx, getState());
		enterRule(_localctx, 0, RULE_formulas);
		int _la;
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(9); 
			_errHandler.sync(this);
			_la = _input.LA(1);
			do {
				{
				{
				setState(8); formula();
				}
				}
				setState(11); 
				_errHandler.sync(this);
				_la = _input.LA(1);
			} while ( (((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << PARIZ) | (1L << NO) | (1L << BOOLEANO) | (1L << LITERAL))) != 0) );
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class FormulaContext extends ParserRuleContext {
		public ProposicionContext proposicion() {
			return getRuleContext(ProposicionContext.class,0);
		}
		public TerminalNode PUNTOCOMA() { return getToken(logpropParser.PUNTOCOMA, 0); }
		public FormulaContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_formula; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof logpropListener ) ((logpropListener)listener).enterFormula(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof logpropListener ) ((logpropListener)listener).exitFormula(this);
		}
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof logpropVisitor ) return ((logpropVisitor<? extends T>)visitor).visitFormula(this);
			else return visitor.visitChildren(this);
		}
	}

	public final FormulaContext formula() throws RecognitionException {
		FormulaContext _localctx = new FormulaContext(_ctx, getState());
		enterRule(_localctx, 2, RULE_formula);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(13); proposicion(0);
			setState(14); match(PUNTOCOMA);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class ProposicionContext extends ParserRuleContext {
		public int _p;
		public ProposicionContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); }
		public ProposicionContext(ParserRuleContext parent, int invokingState, int _p) {
			super(parent, invokingState);
			this._p = _p;
		}
		@Override public int getRuleIndex() { return RULE_proposicion; }
	 
		public ProposicionContext() { }
		public void copyFrom(ProposicionContext ctx) {
			super.copyFrom(ctx);
			this._p = ctx._p;
		}
	}
	public static class Termino_finalContext extends ProposicionContext {
		public TerminoContext termino() {
			return getRuleContext(TerminoContext.class,0);
		}
		public Termino_finalContext(ProposicionContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof logpropListener ) ((logpropListener)listener).enterTermino_final(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof logpropListener ) ((logpropListener)listener).exitTermino_final(this);
		}
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof logpropVisitor ) return ((logpropVisitor<? extends T>)visitor).visitTermino_final(this);
			else return visitor.visitChildren(this);
		}
	}
	public static class CondicionContext extends ProposicionContext {
		public List<ProposicionContext> proposicion() {
			return getRuleContexts(ProposicionContext.class);
		}
		public ProposicionContext proposicion(int i) {
			return getRuleContext(ProposicionContext.class,i);
		}
		public TerminalNode SI() { return getToken(logpropParser.SI, 0); }
		public CondicionContext(ProposicionContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof logpropListener ) ((logpropListener)listener).enterCondicion(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof logpropListener ) ((logpropListener)listener).exitCondicion(this);
		}
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof logpropVisitor ) return ((logpropVisitor<? extends T>)visitor).visitCondicion(this);
			else return visitor.visitChildren(this);
		}
	}
	public static class ParentesisContext extends ProposicionContext {
		public ProposicionContext proposicion() {
			return getRuleContext(ProposicionContext.class,0);
		}
		public TerminalNode PARIZ() { return getToken(logpropParser.PARIZ, 0); }
		public TerminalNode PARDE() { return getToken(logpropParser.PARDE, 0); }
		public ParentesisContext(ProposicionContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof logpropListener ) ((logpropListener)listener).enterParentesis(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof logpropListener ) ((logpropListener)listener).exitParentesis(this);
		}
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof logpropVisitor ) return ((logpropVisitor<? extends T>)visitor).visitParentesis(this);
			else return visitor.visitChildren(this);
		}
	}
	public static class BicondicionContext extends ProposicionContext {
		public List<ProposicionContext> proposicion() {
			return getRuleContexts(ProposicionContext.class);
		}
		public ProposicionContext proposicion(int i) {
			return getRuleContext(ProposicionContext.class,i);
		}
		public TerminalNode SISOLOSI() { return getToken(logpropParser.SISOLOSI, 0); }
		public BicondicionContext(ProposicionContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof logpropListener ) ((logpropListener)listener).enterBicondicion(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof logpropListener ) ((logpropListener)listener).exitBicondicion(this);
		}
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof logpropVisitor ) return ((logpropVisitor<? extends T>)visitor).visitBicondicion(this);
			else return visitor.visitChildren(this);
		}
	}
	public static class NegacionContext extends ProposicionContext {
		public ProposicionContext proposicion() {
			return getRuleContext(ProposicionContext.class,0);
		}
		public TerminalNode NO() { return getToken(logpropParser.NO, 0); }
		public NegacionContext(ProposicionContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof logpropListener ) ((logpropListener)listener).enterNegacion(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof logpropListener ) ((logpropListener)listener).exitNegacion(this);
		}
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof logpropVisitor ) return ((logpropVisitor<? extends T>)visitor).visitNegacion(this);
			else return visitor.visitChildren(this);
		}
	}
	public static class DisyuncionContext extends ProposicionContext {
		public List<ProposicionContext> proposicion() {
			return getRuleContexts(ProposicionContext.class);
		}
		public TerminalNode O() { return getToken(logpropParser.O, 0); }
		public ProposicionContext proposicion(int i) {
			return getRuleContext(ProposicionContext.class,i);
		}
		public DisyuncionContext(ProposicionContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof logpropListener ) ((logpropListener)listener).enterDisyuncion(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof logpropListener ) ((logpropListener)listener).exitDisyuncion(this);
		}
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof logpropVisitor ) return ((logpropVisitor<? extends T>)visitor).visitDisyuncion(this);
			else return visitor.visitChildren(this);
		}
	}
	public static class ConjuncionContext extends ProposicionContext {
		public List<ProposicionContext> proposicion() {
			return getRuleContexts(ProposicionContext.class);
		}
		public ProposicionContext proposicion(int i) {
			return getRuleContext(ProposicionContext.class,i);
		}
		public TerminalNode Y() { return getToken(logpropParser.Y, 0); }
		public ConjuncionContext(ProposicionContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof logpropListener ) ((logpropListener)listener).enterConjuncion(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof logpropListener ) ((logpropListener)listener).exitConjuncion(this);
		}
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof logpropVisitor ) return ((logpropVisitor<? extends T>)visitor).visitConjuncion(this);
			else return visitor.visitChildren(this);
		}
	}

	public final ProposicionContext proposicion(int _p) throws RecognitionException {
		ParserRuleContext _parentctx = _ctx;
		int _parentState = getState();
		ProposicionContext _localctx = new ProposicionContext(_ctx, _parentState, _p);
		ProposicionContext _prevctx = _localctx;
		int _startState = 4;
		enterRecursionRule(_localctx, RULE_proposicion);
		try {
			int _alt;
			enterOuterAlt(_localctx, 1);
			{
			setState(24);
			switch (_input.LA(1)) {
			case NO:
				{
				_localctx = new NegacionContext(_localctx);
				_ctx = _localctx;
				_prevctx = _localctx;

				setState(17); match(NO);
				setState(18); proposicion(6);
				}
				break;
			case PARIZ:
				{
				_localctx = new ParentesisContext(_localctx);
				_ctx = _localctx;
				_prevctx = _localctx;
				setState(19); match(PARIZ);
				setState(20); proposicion(0);
				setState(21); match(PARDE);
				}
				break;
			case BOOLEANO:
			case LITERAL:
				{
				_localctx = new Termino_finalContext(_localctx);
				_ctx = _localctx;
				_prevctx = _localctx;
				setState(23); termino();
				}
				break;
			default:
				throw new NoViableAltException(this);
			}
			_ctx.stop = _input.LT(-1);
			setState(40);
			_errHandler.sync(this);
			_alt = getInterpreter().adaptivePredict(_input,3,_ctx);
			while ( _alt!=2 && _alt!=-1 ) {
				if ( _alt==1 ) {
					if ( _parseListeners!=null ) triggerExitRuleEvent();
					_prevctx = _localctx;
					{
					setState(38);
					switch ( getInterpreter().adaptivePredict(_input,2,_ctx) ) {
					case 1:
						{
						_localctx = new ConjuncionContext(new ProposicionContext(_parentctx, _parentState, _p));
						pushNewRecursionContext(_localctx, _startState, RULE_proposicion);
						setState(26);
						if (!(5 >= _localctx._p)) throw new FailedPredicateException(this, "5 >= $_p");
						setState(27); match(Y);
						setState(28); proposicion(6);
						}
						break;

					case 2:
						{
						_localctx = new DisyuncionContext(new ProposicionContext(_parentctx, _parentState, _p));
						pushNewRecursionContext(_localctx, _startState, RULE_proposicion);
						setState(29);
						if (!(4 >= _localctx._p)) throw new FailedPredicateException(this, "4 >= $_p");
						setState(30); match(O);
						setState(31); proposicion(5);
						}
						break;

					case 3:
						{
						_localctx = new CondicionContext(new ProposicionContext(_parentctx, _parentState, _p));
						pushNewRecursionContext(_localctx, _startState, RULE_proposicion);
						setState(32);
						if (!(3 >= _localctx._p)) throw new FailedPredicateException(this, "3 >= $_p");
						setState(33); match(SI);
						setState(34); proposicion(3);
						}
						break;

					case 4:
						{
						_localctx = new BicondicionContext(new ProposicionContext(_parentctx, _parentState, _p));
						pushNewRecursionContext(_localctx, _startState, RULE_proposicion);
						setState(35);
						if (!(2 >= _localctx._p)) throw new FailedPredicateException(this, "2 >= $_p");
						setState(36); match(SISOLOSI);
						setState(37); proposicion(3);
						}
						break;
					}
					} 
				}
				setState(42);
				_errHandler.sync(this);
				_alt = getInterpreter().adaptivePredict(_input,3,_ctx);
			}
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			unrollRecursionContexts(_parentctx);
		}
		return _localctx;
	}

	public static class TerminoContext extends ParserRuleContext {
		public TerminoContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_termino; }
	 
		public TerminoContext() { }
		public void copyFrom(TerminoContext ctx) {
			super.copyFrom(ctx);
		}
	}
	public static class BooleanoContext extends TerminoContext {
		public TerminalNode BOOLEANO() { return getToken(logpropParser.BOOLEANO, 0); }
		public BooleanoContext(TerminoContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof logpropListener ) ((logpropListener)listener).enterBooleano(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof logpropListener ) ((logpropListener)listener).exitBooleano(this);
		}
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof logpropVisitor ) return ((logpropVisitor<? extends T>)visitor).visitBooleano(this);
			else return visitor.visitChildren(this);
		}
	}
	public static class LiteralContext extends TerminoContext {
		public TerminalNode LITERAL() { return getToken(logpropParser.LITERAL, 0); }
		public LiteralContext(TerminoContext ctx) { copyFrom(ctx); }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof logpropListener ) ((logpropListener)listener).enterLiteral(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof logpropListener ) ((logpropListener)listener).exitLiteral(this);
		}
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof logpropVisitor ) return ((logpropVisitor<? extends T>)visitor).visitLiteral(this);
			else return visitor.visitChildren(this);
		}
	}

	public final TerminoContext termino() throws RecognitionException {
		TerminoContext _localctx = new TerminoContext(_ctx, getState());
		enterRule(_localctx, 6, RULE_termino);
		try {
			setState(45);
			switch (_input.LA(1)) {
			case BOOLEANO:
				_localctx = new BooleanoContext(_localctx);
				enterOuterAlt(_localctx, 1);
				{
				setState(43); match(BOOLEANO);
				}
				break;
			case LITERAL:
				_localctx = new LiteralContext(_localctx);
				enterOuterAlt(_localctx, 2);
				{
				setState(44); match(LITERAL);
				}
				break;
			default:
				throw new NoViableAltException(this);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) {
		switch (ruleIndex) {
		case 2: return proposicion_sempred((ProposicionContext)_localctx, predIndex);
		}
		return true;
	}
	private boolean proposicion_sempred(ProposicionContext _localctx, int predIndex) {
		switch (predIndex) {
		case 0: return 5 >= _localctx._p;

		case 1: return 4 >= _localctx._p;

		case 2: return 3 >= _localctx._p;

		case 3: return 2 >= _localctx._p;
		}
		return true;
	}

	public static final String _serializedATN =
		"\3\uacf5\uee8c\u4f5d\u8b0d\u4a45\u78bd\u1b2f\u3378\3\r\62\4\2\t\2\4\3"+
		"\t\3\4\4\t\4\4\5\t\5\3\2\6\2\f\n\2\r\2\16\2\r\3\3\3\3\3\3\3\4\3\4\3\4"+
		"\3\4\3\4\3\4\3\4\3\4\5\4\33\n\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3"+
		"\4\3\4\3\4\7\4)\n\4\f\4\16\4,\13\4\3\5\3\5\5\5\60\n\5\3\5\2\6\2\4\6\b"+
		"\2\2\65\2\13\3\2\2\2\4\17\3\2\2\2\6\32\3\2\2\2\b/\3\2\2\2\n\f\5\4\3\2"+
		"\13\n\3\2\2\2\f\r\3\2\2\2\r\13\3\2\2\2\r\16\3\2\2\2\16\3\3\2\2\2\17\20"+
		"\5\6\4\2\20\21\7\3\2\2\21\5\3\2\2\2\22\23\b\4\1\2\23\24\7\6\2\2\24\33"+
		"\5\6\4\2\25\26\7\4\2\2\26\27\5\6\4\2\27\30\7\5\2\2\30\33\3\2\2\2\31\33"+
		"\5\b\5\2\32\22\3\2\2\2\32\25\3\2\2\2\32\31\3\2\2\2\33*\3\2\2\2\34\35\6"+
		"\4\2\3\35\36\7\7\2\2\36)\5\6\4\2\37 \6\4\3\3 !\7\b\2\2!)\5\6\4\2\"#\6"+
		"\4\4\3#$\7\t\2\2$)\5\6\4\2%&\6\4\5\3&\'\7\n\2\2\')\5\6\4\2(\34\3\2\2\2"+
		"(\37\3\2\2\2(\"\3\2\2\2(%\3\2\2\2),\3\2\2\2*(\3\2\2\2*+\3\2\2\2+\7\3\2"+
		"\2\2,*\3\2\2\2-\60\7\13\2\2.\60\7\f\2\2/-\3\2\2\2/.\3\2\2\2\60\t\3\2\2"+
		"\2\7\r\32(*/";
	public static final ATN _ATN =
		ATNSimulator.deserialize(_serializedATN.toCharArray());
	static {
		_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
		for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
			_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
		}
	}
}